#ifndef MESH_H
#define MESH_H

#include "gfxTool.h"

struct Tri_Face
{
	Vertex3f *p1, *p2, *p3;

	Tri_Face()
	{
	}

	Tri_Face(Vertex3f *v1,Vertex3f *v2,Vertex3f *v3)
	{
		p1 = v1;
		p2 = v2;
		p3 = v3;
	}
};

class Mesh
{
public:
    Mesh();

	//deformation
	//gaussian selection and affection
	void GetAffectedAreaInformation(gfxTool *tool);
	void GetAffectedAreaInformation(gfxTool *tool, Vertex3f *firstVertex, Vertex3f *secondVertex);
	void AffectSelectedArea1dGaussian(gfxTool *tool, Vertex3f *targetPosition);

	//tessellation
	void TesselateAroundVertices(gfxTool *tool);
	void TesselateFace(Tri_Face *face, gfxTool *tool, int firstVertexIndex, int secondVertexIndex, int thirdVertexIndex);

	//geometry
	QList<Vertex3f*>* GetPath(Vertex3f *first, Vertex3f *second);
	Vertex3f* GetNearestVertex(Vertex3f *pointinSpace);

	//render mesh
	void RenderMesh(int drawingMode, bool checkColor);

	//clearing and deletion
	void clearMesh();
	~Mesh();
	
	//vars
	QList<Vertex3f*> vertices;
	QList<Tri_Face*> faces;

	Color4b *FillColor, *LinesColor;
};

#endif // MESH_H
